package com.cyj.controller;

import com.cyj.utils.IPFSUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
@RestController
public class TestController {
    @PostMapping("upload")
    public String upload(String data) throws IOException {
       return IPFSUtils.upload(data.getBytes(StandardCharsets.UTF_8));
    }
    @PostMapping("download")
    public String download(String hash) throws IOException {
        return IPFSUtils.download(hash);
    }
}
